package view.panel
{
	import control.panel.IPanelControl;
	import control.panel.VipSetPanelControl;
	
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import utils.TextTool;
	
	import view.LabelText;
	import view.components.CheckButton;
	import view.components.ImgButton;
	import view.components.RadioGroup;
	
	public class VipSetPanel extends AbsPanel
	{
		
		private var timeText:TextField;
		private var titleText:LabelText;
		private var yesCheck:CheckButton;
		private var noCheck:CheckButton;
		private var group:RadioGroup;
		
		public function VipSetPanel(panelControl:IPanelControl)
		{
			super(panelControl);
			resetBg(250,150,1,true);
			initCloseBut();
			resetCloseBut();
			initTitle("text_title_vip");
			
			initTweenPanelOpen();
			dropShadow();
			
			initText();
			initCheck();
			initBut();
		}
		
		private function initBut():void
		{
			addChild(new ImgButton(100,110,0,onYes,50,22,"butBg",null,"确定"));
		}
		
		private function onYes(event:MouseEvent):void
		{
			(panelControl as VipSetPanelControl).onVipSet(group.selectedIndex);
		}
		
		private function initCheck():void
		{
			yesCheck = new CheckButton(78,80,1,onCheck);
			yesCheck.setTitle("显示");
			noCheck = new CheckButton(138,80,0,onCheck);
			noCheck.setTitle("不显示");
			
			addChild(noCheck);
			addChild(yesCheck);
			group = new RadioGroup();
			
			group.addRadio(noCheck);
			group.addRadio(yesCheck);
			group.selectedIndex = 0;
		}
		
		private function onCheck(event:MouseEvent):void
		{
			
		}
		
		private function initText():void
		{
			timeText = TextTool.getTextFieldXY(30,30,200,20,12,0xAAAAAA,"",false,false,"center");
			addChild(timeText);
			
			titleText = new LabelText(35,50,220,20,'在游戏中是否显示"VIP"标志?',0xFFFF00,14);
			addChild(titleText);
		}
		
		public function selectYesNo(isYes:Boolean):void
		{
			if (isYes)
			{
				group.selectedIndex = 1;
			}
			else
			{
				group.selectedIndex = 0;
			}
		}
		
		public function updateDeadTime(v:String):void
		{
			timeText.text = "VIP到期时间:" + v;
		}
	}
}